package com.lucanjun.cn.springboot.common.utils;

import com.lucanjun.cn.springboot.business.model.vo.base.LoginInfoVo;

/**
 * @author lucanjun
 * @version 1.0.0
 * @title LoginInfoUtil
 * @create 2024-12-19 16:55:19
 * @description 登录用户工具类
 */
public class LoginInfoUtil {

    private static final ThreadLocal<LoginInfoVo> loginInfoThreadLocal = new ThreadLocal<>();

    /**
     * 添加登录用户信息
     *
     * @param loginInfoVo
     */
    public static void set(LoginInfoVo loginInfoVo) {
        loginInfoThreadLocal.set(loginInfoVo);
    }

    /**
     * 获取登录用户信息
     *
     * @return
     */
    public static LoginInfoVo get() {
        return loginInfoThreadLocal.get();
    }

    /**
     * 删除登录用户信息
     */
    public static void remove() {
        loginInfoThreadLocal.remove();
    }

}
